<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>发布通知</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- 引入外部头文件 -->
    <include file="layout/header" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="__PUBLIC__/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    <include file="layout/footer" />
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/umeditor/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/umeditor/umeditor.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/umeditor/lang/zh-cn/zh-cn.js"></script>
    <style type="text/css">
    h1 {
        font-family: "微软雅黑";
        font-weight: normal;
    }
    </style>
    <!-- <link rel="stylesheet" href="__PUBLIC__/plugins/datatables/select.bootstrap.min.css"> -->
    <!-- ／定制结束 -->
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>

<body class="hold-transition skin-blue sidebar-mini ">
    <div class="wrapper">
        <!-- 菜单 -->
        <include file="layout/menu" name="普通会员" />
        <!-- ／导航菜单 -->
        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>
        用户管理
        <small>收货地址管理</small>
      </h1>
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                    <li><a href="#">管理</a></li>
                    <li class="active">收货地址管理</li>
                </ol>
            </section>
            <!-- Main content -->
            <section class="content">
                <!-- quick email widget -->
                <div class="box box-info">
                    <div class="box-header">
                        <i class="fa fa-envelope"></i>
                        <h3 class="box-title">发布通知</h3>
                        <div class="box-tools pull-right">
                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                            </button>
                            <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                    <div class="box-body">
                        <form id="form" action="__APP__/Home/PublicAction/Notice/submit" method="post">
                            <div class="form-group">
                                <input type="text" class="form-control" name="rec_id" placeholder="收信人:">
                            </div>
                            <div class="form-group">
                                <input type="text" class="form-control" name="title" placeholder="标题">
                            </div>
                            <div>
                                <script type="text/plain" id="myEditor" name="content" style="width:100%;height:300px;">
                                    <p>在这添加图文描述</p>
                                </script>
                                <div class="clear"></div>
                            </div>
                        </form>
                    </div>
                    <div class="box-footer clearfix">
                        <button type="button" class="pull-right btn btn-default" id="sendEmail" onclick="submitpost()">发布
                            <i class="fa fa-arrow-circle-right"></i></button>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <div class="box">
                            <div class="box-header">
                                <h3 class="box-title">通知消息列表</h3>
                                <div class="box-tools">
                                    <div class="input-group input-group-sm" style="width: 150px;">
                                        <input type="text" name="table_search" class="form-control pull-right" placeholder="Search">
                                        <div class="input-group-btn">
                                            <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- /.box-header -->
                            <div class="box-body table-responsive no-padding">
                                <table class="table table-hover">
                                    <tr>
                                        <th>ID</th>
                                        <th>标题</th>
                                        <th>日期</th>
                                        <th>摘要</th>
                                        <th>状态</th>
                                        <th></th>
                                    </tr>
                                    <volist name="noticelist" id="notice">
                                        <tr>
                                            <td>{$i}</td>
                                            <td>{$notice.title}</td>
                                            <td>{:date("Y-m-d H:i:s",$notice['datetime'])}</td>
                                            <td>Test</td>
                                            <td>Test</td>
                                            <td><a href="__APP__/Home/PublicAction/Notice/getContent/id/{$notice.notice_id}" target="_blank">详情</a></td>
                                        </tr>
                                    </volist>
                                </table>
                            </div>
                            <!-- /.box-body -->
                            <div class="box-footer clearfix">
                                <ul class="pagination pagination-sm no-margin pull-right">
                                    <li><a href="#">&laquo;</a></li>
                                    <li><a href="#">1</a></li>
                                    <li><a href="#">2</a></li>
                                    <li><a href="#">3</a></li>
                                    <li><a href="#">&raquo;</a></li>
                                </ul>
                            </div>
                        </div>
                        <!-- /.box -->
                    </div>
                </div>
                <!--style给定宽度可以影响编辑器的最终宽度-->
            </section>
            <!-- /.content -->
        </div>
        <!-- /.content-wrapper -->
        <include file="layout/copyright" />
    </div>
    <!-- ./wrapper -->
    <!-- REQUIRED JS SCRIPTS -->
    <!-- 外头文件 -->
    <!-- 当前定制 -->
    <!-- DOM 操作 -->
    <!-- ./DOM -->
    <!-- AJAX -->
    <script type="text/javascript">
    function insertHtml() {
        var value = prompt('插入html代码', '');
        um.execCommand('insertHtml', value)
    }

    function isFocus() {
        alert(um.isFocus())
    }

    function doBlur() {
        um.blur()
    }

    function createEditor() {
        // enableBtn();
        um = UM.getEditor('myEditor');
    }

    function getAllHtml() {
        alert(UM.getEditor('myEditor').getAllHtml())
    }

    function getContent() {
        var arr = [];
        arr.push("使用editor.getContent()方法可以获得编辑器的内容");
        arr.push("内容为：");
        arr.push(UM.getEditor('myEditor').getContent());
        alert(arr.join("\n"));
    }

    function getPlainTxt() {
        var arr = [];
        arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
        arr.push("内容为：");
        arr.push(UM.getEditor('myEditor').getPlainTxt());
        alert(arr.join('\n'))
    }

    function setContent(isAppendTo) {
        var arr = [];
        arr.push("使用editor.setContent('欢迎使用umeditor')方法可以设置编辑器的内容");
        UM.getEditor('myEditor').setContent('欢迎使用umeditor', isAppendTo);
        alert(arr.join("\n"));
    }

    function setDisabled() {
        UM.getEditor('myEditor').setDisabled('fullscreen');
        disableBtn("enable");
    }

    function setEnabled() {
        UM.getEditor('myEditor').setEnabled();
        enableBtn();
    }

    function getText() {
        //当你点击按钮时编辑区域已经失去了焦点，如果直接用getText将不会得到内容，所以要在选回来，然后取得内容
        var range = UM.getEditor('myEditor').selection.getRange();
        range.select();
        var txt = UM.getEditor('myEditor').selection.getText();
        alert(txt)
    }

    function getContentTxt() {
        var arr = [];
        arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
        arr.push("编辑器的纯文本内容为：");
        arr.push(UM.getEditor('myEditor').getContentTxt());
        alert(arr.join("\n"));
    }

    function hasContent() {
        var arr = [];
        arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
        arr.push("判断结果为：");
        arr.push(UM.getEditor('myEditor').hasContents());
        alert(arr.join("\n"));
    }

    function setFocus() {
        UM.getEditor('myEditor').focus();
    }

    function deleteEditor() {
        // disableBtn();
        UM.getEditor('myEditor').destroy();
    }

    function disableBtn(str) {
        var div = document.getElementById('btns');
        var btns = document.getElementsByTagName(div, "button");
        for (var i = 0, btn; btn = btns[i++];) {
            if (btn.id == str) {
                document.removeAttributes(btn, ["disabled"]);
            } else {
                btn.setAttribute("disabled", "true");
            }
        }
    }

    function enableBtn() {
        var div = document.getElementById('btns');
        var btns = document.getElementsByTagName(div, "button");
        for (var i = 0, btn; btn = btns[i++];) {
            document.removeAttributes(btn, ["disabled"]);
        }
    }

    function submitpost() {
        if (UM.getEditor('myEditor').hasContents()) {
            // $.post('__APP__/Home/PublicAction/Notice/submit',{
            //     'content':UM.getEditor('myEditor').getContent()
            //     },function(data){
            //         alert(data)
            // });
            $('#form').submit();

        }
    }
    $(function() {
        var um = UM.getEditor('myEditor', {
            /* 传入配置参数,可配参数列表看umeditor.config.js */
            imageUrl: "__APP__/Home/PublicAction/Notice/uploadImg" //图片上传提交地址
                ,
            imagePath: "__ROOT__/" //图片修正地址，引用了fixedImagePath,如有特殊需求，可自行配置
                ,
            imageFieldName: "upfile",
            toolbar: [
                'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
                'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize',
                '| justifyleft justifycenter justifyright justifyjustify |',
                'link unlink | emotion image video',
                '| horizontal print preview', 'drafts', 'formula'
            ]
        });

        um.addListener('blur', function() {
            $('#focush2').html('编辑器失去焦点了')
        });
        um.addListener('focus', function() {
            $('#focush2').html('')
        });
        //按钮的操作

    });
    </script>
    <!-- /AJAX -->
    <!-- ./定制结束 -->
</body>

</html>